package com.yl.chainStore.mapper.pay

import com.yl.chainStore.entity.pay.PayCustomerOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.yl.chainStore.pojo.dto.statistical.StatisticalOrderCollectionDto
import com.yl.chainStore.pojo.vo.pay.PayCustomOrderProcessVo
import com.yl.chainStore.pojo.vo.pay.PayCustomOrderToChargeVo
import com.yl.chainStore.pojo.vo.pay.PayCustomerOrderSelectVo
import com.yl.chainStore.pojo.vo.statistical.IncomeSummarySelectVo
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param

/**
 * <p>
 * 订单表 Mapper 接口
 * </p>
 *
 * @author cxw
 * @since 2021-07-09
 */
@Mapper
interface PayCustomerOrderMapper : BaseMapper<PayCustomerOrder>{




	fun getOrderPage(
		@Param("page")page: Page<PayCustomerOrder>,
		@Param("vo")vo:PayCustomerOrderSelectVo):Page<PayCustomerOrder>

	fun getOrderList(
		@Param("vo")vo:PayCustomerOrderSelectVo):List<PayCustomerOrder>

	fun getLastOrder(@Param("vo")vo:PayCustomerOrderSelectVo):PayCustomerOrder?

	fun getSumMoney(@Param("customerId")customerId:Long?,
	                @Param("subCompanyId")subCompanyId:Long?,
	                @Param("companyId")companyId:Long
	):Long

	fun getCustomerOrderAmountSumMoney(@Param("customerId")customerId:Long?,
					@Param("subCompanyId")subCompanyId:Long?,
					@Param("companyId")companyId:Long
	):Long

	/**
	 * 按是否收费 查询订单分页
	 */
	fun getOrderPageByCharge(@Param("page") page: Page<PayCustomerOrder>,@Param("vo") vo: PayCustomOrderToChargeVo):Page<PayCustomerOrder>

	/**
	 * 获取订单数量（是否收费操作）
	 */
	fun getCountByCharge(@Param("vo") vo: PayCustomOrderToChargeVo):Int


	/**
	 * 查询客户订单
	 */
	fun  getCustomOrderList(id: Long):List<PayCustomOrderProcessVo>

	/**
	 * 按日期统计订单
	 */
	fun getOrderStatisticalByDay(@Param("vo") vo: IncomeSummarySelectVo):List<StatisticalOrderCollectionDto>
}
